package com.iwhalecloud.bss.kite.cucc.service.attr.handler;


import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.service.util.ProdCateUtil;
import com.iwhalecloud.bss.kite.manager.api.IOperateSceneInstService;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import com.iwhalecloud.bss.kite.service.attr.handler.AbstractAttrHandler;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <Description> <br>
 *
 * @author zhouJiao<br>
 * @version 1.0<br>
 * @taskId <br>
 * @CreateDate 2021年11月22日 <br>
 * @since R9.0<br>
 * @see com.iwhalecloud.bss.kite.cucc.service.attr.handler <br>
 */

//雁飞民用燃气报警器产品
public class GasAlertorModeAttrHander extends AbstractAttrHandler<KiteInst, AttrData> {
    @Autowired
    private IOperateSceneInstService operateSceneInstService;

    @Override
    public void after(KiteAttr attr, KiteInst inst, AttrData data) {
        super.after(attr, inst, data);
        //产品变更 延期分组置灰
        if (KiteStringUtils.isEqual(data.getServiceOfferId(), "2826")
            && (KiteStringUtils.isEqual(attr.getGroupId(), "300000173") || KiteStringUtils.equalsAny(inst.getSpecId(), ProdCateUtil.getMainMemberProdId(ProdCateUtil.GIFT_YFZH_PROD)))) {
            attr.setIsEdit(KeyConsts.IFTRUE_F);
            operateSceneInstService
                .setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr);
        }
    }
}
